function structure = fillRateQ(structure, quarter_lookfor, quarter, rate, default, unhealthy)

if unhealthy == 1
    return;
end

quarter_lookfor_length = length(quarter_lookfor);
for j = 1 : quarter_lookfor_length
    if quarter == quarter_lookfor(j)
        %Check if default and it is the last quarter
        if default == 1 && j ~= quarter_lookfor_length
            structure.rates(j + 1) = -2;
        end
        
        if  structure.rates(j) == -1
            structure.rates(j) = rate;
        end
        
        break;
    end
end
    
end